/*     */ package com.umeng.analytics.a;
/*     */ 
/*     */ import com.umeng.common.Log;
/*     */ import java.util.HashMap;
/*     */ import java.util.Iterator;
/*     */ import java.util.Map.Entry;
/*     */ import java.util.Set;
/*     */ import org.json.JSONException;
/*     */ import org.json.JSONObject;
/*     */ 
/*     */ public class a
/*     */   implements g
/*     */ {
/*     */   public final HashMap<String, String> a;
/*     */   public String b;
/*  20 */   public long c = 0L;
/*  21 */   public long d = 0L;
/*     */ 
/*  23 */   private final String e = "id";
/*  24 */   private final String f = "ts";
/*  25 */   private final String g = "du";
/*     */ 
/*     */   public a() {
/*  28 */     this.a = new HashMap();
/*     */   }
/*     */ 
/*     */   public a(String paramString, HashMap<String, String> paramHashMap, long paramLong) {
/*  32 */     this.b = paramString;
/*  33 */     this.a = a(paramHashMap);
/*  34 */     this.d = paramLong;
/*     */ 
/*  36 */     this.c = b();
/*     */   }
/*     */ 
/*     */   private HashMap<String, String> a(HashMap<String, String> paramHashMap) {
/*  40 */     if (paramHashMap.size() > 10)
/*     */     {
/*  42 */       int i = 0;
/*  43 */       int j = paramHashMap.size() - 10;
/*     */ 
/*  45 */       String[] arrayOfString1 = new String[j];
/*     */       String str;
/*  47 */       for (Iterator localIterator = paramHashMap.keySet().iterator(); localIterator.hasNext(); ) { str = (String)localIterator.next();
/*     */ 
/*  49 */         if (i >= j)
/*     */           break;
/*  51 */         arrayOfString1[i] = str;
/*     */ 
/*  53 */         i++;
/*     */       }
/*     */ 
/*  56 */       for (str : arrayOfString1) {
/*  57 */         paramHashMap.remove(str);
/*     */       }
/*     */     }
/*     */ 
/*  61 */     return paramHashMap;
/*     */   }
/*     */ 
/*     */   private long b() {
/*  65 */     return System.currentTimeMillis() / 1000L;
/*     */   }
/*     */ 
/*     */   private void c(JSONObject paramJSONObject) throws JSONException {
/*  69 */     for (Map.Entry localEntry : this.a.entrySet())
/*  70 */       paramJSONObject.put((String)localEntry.getKey(), localEntry.getValue());
/*     */   }
/*     */ 
/*     */   private void d(JSONObject paramJSONObject)
/*     */     throws Exception
/*     */   {
/*  76 */     paramJSONObject.remove("id");
/*  77 */     paramJSONObject.remove("ts");
/*  78 */     paramJSONObject.remove("du");
/*     */ 
/*  81 */     Iterator localIterator = paramJSONObject.keys();
/*     */ 
/*  83 */     while (localIterator.hasNext())
/*     */     {
/*  85 */       String str = (String)localIterator.next();
/*     */ 
/*  87 */       this.a.put(str, paramJSONObject.getString(str));
/*     */     }
/*     */   }
/*     */ 
/*     */   public void a(JSONObject paramJSONObject) {
/*  92 */     if (paramJSONObject == null) return;
/*     */     try
/*     */     {
/*  95 */       this.b = paramJSONObject.getString("id");
/*  96 */       this.c = paramJSONObject.getLong("ts");
/*     */ 
/*  98 */       if (paramJSONObject.has("du")) {
/*  99 */         this.d = paramJSONObject.getLong("du");
/*     */       }
/*     */ 
/* 102 */       d(paramJSONObject);
/*     */     } catch (Exception localException) {
/* 104 */       localException.printStackTrace();
/*     */     }
/*     */   }
/*     */ 
/*     */   public void b(JSONObject paramJSONObject)
/*     */     throws JSONException
/*     */   {
/*     */     try
/*     */     {
/* 113 */       paramJSONObject.put("id", this.b);
/* 114 */       paramJSONObject.put("ts", this.c);
/*     */ 
/* 116 */       if (this.d > 0L) paramJSONObject.put("du", this.d);
/*     */ 
/* 118 */       c(paramJSONObject);
/*     */     }
/*     */     catch (Exception localException) {
/* 121 */       localException.printStackTrace();
/*     */     }
/*     */   }
/*     */ 
/*     */   public boolean a()
/*     */   {
/* 128 */     if ((this.b == null) || (this.c <= 0L)) {
/* 129 */       Log.b("MobclickAgent", "mId or mTs is not initialized");
/* 130 */       return false;
/*     */     }
/*     */ 
/* 133 */     if (this.a.isEmpty()) {
/* 134 */       Log.b("MobclickAgent", "mCustomKV is not initialized");
/* 135 */       return false;
/*     */     }
/*     */ 
/* 138 */     return true;
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\umeng_sdk.jar
 * Qualified Name:     com.umeng.analytics.a.a
 * JD-Core Version:    0.6.2
 */